{"id":32171077,"url":"https://github.com/elixir-wechat/ueberauth_weixin","last_synced_at":"2026-02-20T00:32:00.142Z","repository":{"id":34437539,"uuid":"179049281","full_name":"elixir-wechat/ueberauth_weixin","owner":"elixir-wechat","description":"Wechat OAuth2 strategies for Überauth","archived":false,"fork":false,"pushed_at":"2023-04-01T01:58:10.000Z","size":82,"stargazers_count":5,"open_issues_count":4,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-21T17:49:48.739Z","etag":null,"topics":["elixir","oauth2","ueberauth","wechat","weixin"],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/ueberauth_weixin","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elixir-wechat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-02T09:58:23.000Z","updated_at":"2021-04-29T08:56:52.000Z","dependencies_parsed_at":"2023-02-17T00:30:52.240Z","dependency_job_id":null,"html_url":"https://github.com/elixir-wechat/ueberauth_weixin","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/elixir-wechat/ueberauth_weixin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-wechat%2Fueberauth_weixin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-wechat%2Fueberauth_weixin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-wechat%2Fueberauth_weixin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-wechat%2Fueberauth_weixin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elixir-wechat","download_url":"https://codeload.github.com/elixir-wechat/ueberauth_weixin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-wechat%2Fueberauth_weixin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29637410,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T22:32:43.237Z","status":"ssl_error","status_checked_at":"2026-02-19T22:32:38.330Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","oauth2","ueberauth","wechat","weixin"],"created_at":"2025-10-21T17:40:43.261Z","updated_at":"2026-02-20T00:32:00.137Z","avatar_url":"https://github.com/elixir-wechat.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Überauth Weixin\n\nWechat OAuth2 strategies for Überauth.\n\nIncludes: \n\n* `:weixin` - Wechat open platform (https://open.weixin.qq.com)\n* `:wechat` - Wechat official accounts platform (https://mp.weixin.qq.com)\n\n## Installation\n\n```elixir\ndef deps do\n  {:ueberauth_weixin, \"~\u003e 1.0\"}\nend\n```\n\n## Usage\n\n### Config router.ex in Phoenix project\n\n```elixir\nscope \"/auth\", MyAppWeb do\n  pipe_through :browser\n\n  get \"/:provider\", AuthController, :request\n  get \"/:provider/callback\", AuthController, :callback\nend\n```\n\n### Config strategies\n\n* Wechat open platform\n\n  ```elixir\n  config :ueberauth, Ueberauth,\n    providers: [\n      weixin: {Ueberauth.Strategy.Weixin, [uid_field: :unionid]}\n    ]\n\n  config :ueberauth, Ueberauth.Strategy.Weixin,\n    client_id: \"YOUR_APPID\",\n    client_secret: \"YOUR_SECRET\"\n  ```\n\n* Wechat official accounts platform\n\n  ```elixir\n  config :ueberauth, Ueberauth,\n    providers: [\n      wechat: {Ueberauth.Strategy.Wechat, [uid_field: :unionid]}\n    ]\n\n  config :ueberauth, Ueberauth.Strategy.Wechat,\n    client_id: \"YOUR_APPID\",\n    client_secret: \"YOUR_SECRET\"\n  ```\n\n\u003e Option `uid_field` has two values: `:openid` and `:unionid`. Default: `:openid`. \n  `uid` in `%Ueberauth.Auth{}`depends on this option.\n\n## Workflow\n\n1. Visit `/auth/:provider` to start the OAuth2 workflow\n\n2. If authorization succeeds, it will redirect user back to `/auth/:provider/callback` with the `%Ueberauth.Auth{}` struct\n\n```elixir\ndef callback(%Plug.Conn{assigns: %{ueberauth_auth: auth}} = conn, _params) do\n  %Ueberauth.Auth{provider: provider, uid: uid} = auth\n\n  # other logic\nend\n```\n3. If authorization fails, it will not redirect the user back.\n\n## Ueberauth.Auth struct for :weixin strategy\n\n```elixir\n%Ueberauth.Auth{\n  credentials: %Ueberauth.Auth.Credentials{\n    expires: true,\n    expires_at: 1554813400,\n    other: %{\n      \"openid\" =\u003e \"oRvxY6DXNEdehn5sPypKvep9zyds\",\n      \"unionid\" =\u003e \"o2oUsuOUzgNL-JSLtIp8b3FzkI-M\"\n    },\n    refresh_token: \"20_MT0uS2Zml9dqA03WsSdtsgUFTYGvWp7YSNrKmvzdVAyqrZv2_6uAvpHjauWAvY4GEbu-LAs7_QbSJ94d9y_BRw\",\n    scopes: [\"snsapi_login\"],\n    secret: nil,\n    token: \"20_3wMtd0cEIkNm1spcQpdixg_14VbXOdEKoGVtkmUBSQDvqkWDEi6WozUVcw7fch92gAwK_Eyh0aO8_uUWts-9hg\",\n    token_type: \"Bearer\"\n  },\n  extra: %Ueberauth.Auth.Extra{\n    raw_info: %{\n      \"city\" =\u003e \"Baoshan\",\n      \"country\" =\u003e \"CN\",\n      \"headimgurl\" =\u003e \"http://thirdwx.qlogo.cn/mmopen/vi_32/PiajxSqBRaELP0QPmPFD06qDibHBwWmEzibV3lr9PJufl0JDpeFicV2vg2uw2FLj7728KiaJeribZXWXIaM0WOpFlicAg/132\",\n      \"language\" =\u003e \"zh_CN\",\n      \"nickname\" =\u003e \"yejun.su\",\n      \"openid\" =\u003e \"oRvxY6DXNEdehn5sPypKvep9zyds\",\n      \"privilege\" =\u003e [],\n      \"province\" =\u003e \"Shanghai\",\n      \"sex\" =\u003e 1,\n      \"unionid\" =\u003e \"o2oUsuOUzgNL-JSLtIp8b3FzkI-M\"\n    }\n  },\n  info: %Ueberauth.Auth.Info{\n    description: nil,\n    email: nil,\n    first_name: nil,\n    image: \"http://thirdwx.qlogo.cn/mmopen/vi_32/PiajxSqBRaELP0QPmPFD06qDibHBwWmEzibV3lr9PJufl0JDpeFicV2vg2uw2FLj7728KiaJeribZXWXIaM0WOpFlicAg/132\",\n    last_name: nil,\n    location: nil,\n    name: \"yejun.su\",\n    nickname: \"yejun.su\",\n    phone: nil,\n    urls: %{}\n  },\n  provider: :weixin,\n  strategy: Ueberauth.Strategy.Weixin,\n  uid: \"o2oUsuOUzgNL-JSLtIp8b3FzkI-M\"\n}\n```\n\n## Ueberauth.Auth struct for :wechat strategy\n\n```elixir\n%Ueberauth.Auth{\n  credentials: %Ueberauth.Auth.Credentials{\n    expires: true,\n    expires_at: 1555289733,\n    other: %{\"openid\" =\u003e \"oi00OuKAhA8bm5okpaIDs7WmUZr4\"},\n    refresh_token: \"20_7mjDBge3fRkdYkhkfBa2P-1HuhaZV3rg7BXFPNX4XUgG3fyuPTgI9GtcYbn8-vPp5mwKuvVDXbULlLKuhbWEgERjKG8E-3vkr1OflkEafKs\",\n    scopes: [\"snsapi_userinfo\"],\n    secret: nil,\n    token: \"20_r3UTxXsaApzjSVW7w611ObJBfAUj0_8TjH1PHpT0gVxC3L1C5qkYPZv4ke9aMrsexIu7qwibcdqSMMjg-Krz6gbT7l7a64YVlot4TdcrZpA\",\n    token_type: \"Bearer\"\n  },\n  extra: %Ueberauth.Auth.Extra{\n    raw_info: %{\n      \"city\" =\u003e \"Baoshan\",\n      \"country\" =\u003e \"CN\",\n      \"headimgurl\" =\u003e \"http://thirdwx.qlogo.cn/mmopen/vi_32/PiajxSqBRaELbibcX7pqYNlNy97Ipgu4B7E3FzxIcEnOKnPM1AOBEicqZq0l4xqque9iboicc9lbDictrGCCxzW3fgUg/132\",\n      \"language\" =\u003e \"zh_CN\",\n      \"nickname\" =\u003e \"yejun.su\",\n      \"openid\" =\u003e \"oi00OuKAhA8bm5okpaIDs7WmUZr4\",\n      \"privilege\" =\u003e [],\n      \"province\" =\u003e \"Shanghai\",\n      \"sex\" =\u003e 1\n    }\n  },\n  info: %Ueberauth.Auth.Info{\n    description: nil,\n    email: nil,\n    first_name: nil,\n    image: \"http://thirdwx.qlogo.cn/mmopen/vi_32/PiajxSqBRaELbibcX7pqYNlNy97Ipgu4B7E3FzxIcEnOKnPM1AOBEicqZq0l4xqque9iboicc9lbDictrGCCxzW3fgUg/132\",\n    last_name: nil,\n    location: nil,\n    name: \"yejun.su\",\n    nickname: \"yejun.su\",\n    phone: nil,\n    urls: %{}\n  },\n  provider: :wechat,\n  strategy: Ueberauth.Strategy.Wechat,\n  uid: \"oi00OuKAhA8bm5okpaIDs7WmUZr4\"\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felixir-wechat%2Fueberauth_weixin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felixir-wechat%2Fueberauth_weixin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felixir-wechat%2Fueberauth_weixin/lists"}