Comments (6)
Hey @joenayjoe ,
Could you please clarify the problem you are having? From what you mention, it does not look like a problem with grpc-web itself but rather how to perform user authentication with Github in Go.
Here are some resources that may help https://developer.github.com/v3/guides/getting-started/#authentication
I will close this issue as it does not appear to be directly related to grpc-web. If you feel this is not the case please feel free to comment below and we can take it from there.
from grpc-web.
Hi @easyCZ ,
Ok I will try to explain my problem. When a user clicks the link to log in with Github, he is redirected to Github authorization endpoint. Upon authorizing with user name and password, the user is redirected back to a callback URL How can I intercept that callback from grpc_web server to get the auth token? Since the callback is not a grpc method, I am not quite sure how to get the information from the callback.
May be I am messing up REST with gRPC.
Thanks
from grpc-web.
Thanks for clarification. Looking to give you an example now. Reopening
from grpc-web.
Hi @joenayjoe,
You can provide custom non-grpcweb functionality on the same server.
In the example you can provide a custom handler for any request that reaches the grpcweb server.
grpc-web/example/go/exampleserver/exampleserver.go
Lines 41 to 43 in eda5103
For example, we can do the following, since we have access to the request:
handler := func(resp http.ResponseWriter, req *http.Request) {
if req.URL.Path == "/auth" {
fmt.Fprintf(resp, "Hi there, I love %s!", req.URL.Path[1:])
return
}
wrappedServer.ServeHTTP(resp, req)
}
This allows us to bypass the wrapped server and handle any request. You can get more fancy with this by using chi or echo. Let me know if that solves your problem
from grpc-web.
@easyCZ ,
Thank you for the tips. I tried to make a call to a custom URL and it indeed works.
from grpc-web.
@joenayjoe That's great news. Closing.
from grpc-web.
Related Issues (20)
- Detach IsGrpcWebRequest and IsGrpcWebSocketRequest from WrappedGrpcServer HOT 2
- grpcwebproxy websocket connection fails with specific origin HOT 2
- QUIC and HTTP3 support HOT 1
- Status codes and error messages are displayed incorrectly on the angular client. HOT 4
- Golang Grpc Web Server UnaryInterceptor is not triggered by grpc-web Client HOT 1
- Get client stream method return HOT 3
- ReferenceError: self is not defined when trying to call a grpc-web function from a CLI/server application HOT 3
- grpcwebproxy - Help Proxying existing GRPC service HOT 1
- Add support of bufbuild/protobuf-es HOT 3
- Changing route to the root of the host HOT 1
- Lack of grpc Trailers-Only support in the wrapHandler function
- Is there any way to use Nginx or Envoy with this project? HOT 1
- Question: What is the status of `go/grpcwebproxy` project? HOT 3
- grpc-web: Importing as ESModule in Node HOT 1
- grpcwebproxy `--allowed_headers` param is case-sensitive for WebSocket
- Grpc client unexpected behavior HOT 1
- Project status
- grpc-web. `Response closed without headers` but no way to get the status code.
- grpcwebproxy: 400 bad request on websocket connection attempts HOT 1
- How to set a fieldmask on a grpc request? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grpc-web.