<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Oauth2 on 村边的池塘</title>
    <link>https://jerrywang1981.github.io/tags/oauth2/</link>
    <description>Recent content in Oauth2 on 村边的池塘</description>
    <generator>Hugo</generator>
    <language>zh-CN</language>
    <lastBuildDate>Fri, 09 Apr 2021 20:40:45 +0800</lastBuildDate>
    <atom:link href="https://jerrywang1981.github.io/tags/oauth2/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Golang Oauth2 Github</title>
      <link>https://jerrywang1981.github.io/post/go/golang-oauth2-github/</link>
      <pubDate>Fri, 09 Apr 2021 20:40:45 +0800</pubDate>
      <guid>https://jerrywang1981.github.io/post/go/golang-oauth2-github/</guid>
      <description>Github Oauth2 首先，在github上申请一个Oauth App, 获取client id / secret 需要这些信息，下边的代码是放在环境变量中 AUTH_URL = os.Getenv(&amp;#34;AUTH_URL&amp;#34;) // github authorization url TOKEN_URL = os.Getenv(&amp;#34;TOKEN_URL&amp;#34;) // github token url CLIENT_ID = os.Getenv(&amp;#34;CLIENT_ID&amp;#34;) // client id CLIENT_SECRET = os.Getenv(&amp;#34;CLIENT_SECRET&amp;#34;) // client secret REDIRECT_URL = os.Getenv(&amp;#34;REDIRECT_URL&amp;#34;) // the redirect url 在包的初始化代码中，初始化 var ( oauth2Config *oauth2.Config ) init() { oauth2Config = &amp;amp;oauth2.Config{ ClientID: CLIENT_ID, ClientSecret: CLIENT_SECRET, RedirectURL: REDIRECT_URL, // Discovery returns the OAuth2 endpoints. Endpoint: oauth2.Endpoint{ AuthURL: AUTH_URL, TokenURL: TOKEN_URL, AuthStyle: oauth2.AuthStyleInHeader, }, Scopes: []string{&amp;#34;openid&amp;#34;, &amp;#34;email&amp;#34;, &amp;#34;site_admin&amp;#34;, &amp;#34;repo&amp;#34;, &amp;#34;admin:org&amp;#34;, &amp;#34;user&amp;#34;}, } Login</description>
    </item>
  </channel>
</rss>
