Fix translation for section "OAuth and OAuth 2 authentication" in
14.4.md
This commit is contained in:
26
en/14.4.md
26
en/14.4.md
@@ -50,20 +50,20 @@ The following code demonstrates how to use this library to implement authenticat
|
||||
|
||||
The above code takes advantage of Beego's `prepare()` function to perform authentication before allowing the normal flow of execution to proceed; as you can see, it's very simple to implement HTTP authentication. Digest authentication can be implemented in much the same way.
|
||||
|
||||
## OAuth and OAuth 2 certification
|
||||
## OAuth and OAuth 2 authentication
|
||||
|
||||
OAuth and OAuth 2 is currently more popular two authentication methods, but fortunately, there is a third-party library to achieve this certification, but it is realized abroad, and did not QQ, microblogging like domestic application certified integration:
|
||||
OAuth and OAuth 2 are currently two of the most popular authentication methods. Fortunately, there are third-party libraries which implement this type of authentication such as the `go.auth` package available on github.
|
||||
|
||||
github.com/bradrydzewski/go.auth
|
||||
|
||||
The following code demonstrates how to put the library in order to achieve the introduction of beego OAuth authentication, an example to demonstrate GitHub here:
|
||||
The code below demonstrates how to use this library to implement OAuth authentication in Beego using our Github credentials:
|
||||
|
||||
1. Add two routes
|
||||
1. Let's add some routes
|
||||
|
||||
beego.RegisterController("/auth/login", &controllers.GithubController{})
|
||||
beego.RegisterController("/mainpage", &controllers.PageController{})
|
||||
|
||||
2. Then we deal GithubController landing page:
|
||||
2. Then we deal with the `GithubController` landing page:
|
||||
|
||||
package controllers
|
||||
|
||||
@@ -92,7 +92,7 @@ The following code demonstrates how to put the library in order to achieve the i
|
||||
githubHandler.ServeHTTP(this.Ctx.ResponseWriter, this.Ctx.Request)
|
||||
}
|
||||
|
||||
3. treatment after successful landing pages
|
||||
3. Handling after a successful landing page:
|
||||
|
||||
package controllers
|
||||
|
||||
@@ -129,23 +129,25 @@ The following code demonstrates how to put the library in order to achieve the i
|
||||
this.TplNames = "home.tpl"
|
||||
}
|
||||
|
||||
The whole process is as follows, first open your browser and enter the address:
|
||||
The whole process is as follows:
|
||||
|
||||
first open your browser and enter the address:
|
||||
|
||||

|
||||
|
||||
Figure 14.4 shows the home page with a log in button
|
||||
Figure 14.4 shows the home page with a login button
|
||||
|
||||
Then click on the link following screen appears:
|
||||
When clicking on the link, the following screen appears:
|
||||
|
||||

|
||||
|
||||
Figure 14.5 is displayed after clicking the log in button authorization GitHub page
|
||||
Figure 14.5 displayed after clicking the login button to authenticate with your GitHub credentials
|
||||
|
||||
Then click Authorize app will appear the following interface:
|
||||
After clicking "Authorize app", the following screen appears:
|
||||
|
||||

|
||||
|
||||
Figure 14.6 is displayed after log in authorization to obtain information page GitHub
|
||||
Figure 14.6 authorized Github information gets displayed after the login page
|
||||
|
||||
## Custom authentication
|
||||
|
||||
|
||||
Reference in New Issue
Block a user