build-go | build.go - Program for building Go binaries without a GOPATH | Build Tool library
kandi X-RAY | build-go Summary
kandi X-RAY | build-go Summary
This repository contains a small and self-contained Go program called build.go. It used to compile a binary (package main) from either a checkout of the repository, or from an extracted release tar file. This enables end-users to compile the program without having to setup a GOPATH. For it to function correctly, all dependencies need to be vendored, e.g. with dep or go mod vendor. Then, your build does not depend on any third-party resources on the Internet. For Go >= 1.11, modules are used for building and GOPROXY is set to off so that no Internet is needed when building. The program has a build tag that is not set normally (ignore_build_go) so it is not considered when compiling the other Go code in a repository.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- This is the main entry point for testing .
- copyFile copies src to dst .
- ParseGoVersion parses a go version string .
- Builds the Go code
- copy copies src to dst .
- AtLeast returns true if v is a version of v .
- Clean environment
- Test if CGO is enabled
- getVersion returns the version string
- showUsage shows the usage of the console
build-go Key Features
build-go Examples and Code Snippets
Community Discussions
Trending Discussions on build-go
QUESTION
I was trying set up google authentication with react frontend and django rest framework backend. I set up both the frontend and backend using this two part tutorial, PART1 & PART2. When I try to login with google in the frontend I get POST http://127.0.0.1:8000/google-login/ 400 (Bad Request)
I think it's because my google api needs an access token and an authorization code to be passed. After debugging the react js, I noticed the response I get from google doesn't have an authorization code. I suspect because responseType
is permission
(by default), Source:React login props , instead of code
. I was wondering how would you change the response type in react? (I'm not even sure if this alone is the issue)
Here's my backend code
In my views.py file
...ANSWER
Answered 2021-Nov-04 at 23:26After investigating a bit on my end, I think I might have a solution that works for you.
I've messed with OAuth before, and it's quite tricky sometimes because it has to be robust. So a bunch of security policies usually get in the way.
I'll provide my full step-by-step, since I was able to get it working, trying my best to match what you posted.
Firstly, to have a clean slate, I went off the example code linked in the tutorials. I cloned and built the project, and did the following:
- Creating a new project on GCP
- Configured the OAuth consent screen
- I set the User type to "internal". This options may not be available if you're not using an account under GSuite (which I am). "External" should be fine though, just that "internal" is the easiest to test.
- Created a OAuth 2.0 Client
- Added
http://localhost:3000
to the "Authorized JavaScript origins" and "Authorized redirect URIs" sections
- Added
- Configured the OAuth consent screen
- Register a Django superuser
- Registered a
Site
, with value oflocalhost:8000
for both fields. - Went into the admin panel, and added a
Social Application
withClient ID
andSecret Key
as the "Client ID" and "Client Secret" from GCP, respectively. I also picked the localhost site that we added earlier and added it to the right hand box. (I leftKey
blank)
- Registered a
Example of my Application Page
- Filled in the
clientId
field inApp.js
, in the params of theGoogleLogin
component.
Here's where I ran into a bit of trouble, but this is good news as I was able to reproduce your error! Looking at the request in the network inspector, I see that for me, no body was passed, which is clearly the direct cause of the error. But looking at App#responseGoogle(response)
, it clearly should pass a token of some sort, because we see the line googleLogin(response.accessToken)
.
So what is happening is that accounts.google.com is NOT returning a proper response, so something is happening on their end, and we get an invalid response, but we fail silently because javascript is javascript.
After examining the response that Google gave back, I found this related SO post that allowed me to fix the issue, and interestingly, the solution to it was quite simple: Clear your cache. I'll be honest, I'm not exactly sure why this works, but I suspect it has something to do with the fact that development is on your local machine (localhost
/127.0.0.1
difference, perhaps?).
You can also try to access your site via incognito mode, or another browser, which also worked for me.
I have knox token set up, can I use it instead of the JWT tokens?
I don't think I have enough knowledge to properly answer this, but my preliminary research suggests no. AFAIK, you should just store the token that Google gives you, as the token itself is what you'll use to authenticate. It seems that Knox replaces Django's TokenAuthentication
, which means that Knox is in charge of generating the token. If you're offloading the login work to Google, I don't see how you could leverage something like Knox. However, I could be very wrong.
Does the
class GoogleLogin(SocialLoginView)
, take care of the steps of validating the access token and code with google and creating the user with that email in database?
I believe so. After successfully authenticating with Google (and it calls the backend endpoint correctly), it seems to create a "Social Account" model. An example of what it created for me is below. It retrieved all this information (like my name) from Google.
Example of my "Social Accounts" page
As for how to retrieve the login from the browser's local storage, I have no idea. I see no evidence of a cookie, so it must be storing it somewhere else, or you might have to set that up yourself (with React Provider
s, Service
s, or even Redux
.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install build-go
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page